#!/use/bin/env python
# -*- coding: UTF-8 -*-

from api import app
from thirdServer.avatar import Avatar
from flask import url_for,redirect
from db import db

#redirect(url_for('static', filename=av.get_path()))
@app.route('/avatar',methods=['GET', 'POST'])
def avatar():
	name = "EdwardWeb"
	av = Avatar()
	av.paint_avatar(name)
	app.logger.debug(av.get_path())
	player = db.Player()
	player['coins'] = 403

	app.logger.debug(player)
	try:
		player.validate()
	except Exception, e:
		app.logger.error(e)
		raise
	player.save()
	return 'player.coins ' + str(player['coins'])

@app.route('/login',methods=['GET', 'POST'])
def login():
	return 'login! Edward Tang, login'